﻿Public Class BuildMenu

    Public Sub BuildMenu_DropDown(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MainForm.BuildAllToolStripMenuItem.Enabled = ProjectManager.ProjectOpen
        MainForm.BuildAndRunToolStripMenuItem.Enabled = ProjectManager.ProjectOpen
        MainForm.RunToolStripMenuItem.Enabled = ProjectManager.ProjectOpen
    End Sub

    Public Sub BuildAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Globals.Compiler.FullRebuild = False
        Globals.Compiler.InitMake()
        MainForm.BuildWorker.RunWorkerAsync()
    End Sub

    Public Sub BuildAndRunToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Globals.ExecuteStandaloneOnBuildFinished = True
        Globals.Compiler.FullRebuild = False

        Globals.Compiler.InitMake()
        MainForm.BuildWorker.RunWorkerAsync()
    End Sub

    Public Sub BuildFullToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Globals.Compiler.FullRebuild = True
        Globals.Compiler.InitMake()

        If MainForm.BuildWorker.IsBusy Then
            MainForm.BuildWorker.CancelAsync()
        End If

        MainForm.BuildWorker.RunWorkerAsync()
    End Sub

    Public Sub RunToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Globals.Run.RunStandalone()
    End Sub

    Public Sub ErrorPrevStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MainForm.ErrorView.PrevError()
    End Sub

    Public Sub ErrorNextStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MainForm.ErrorView.NextError()
    End Sub

End Class
